<template>
  <!-- 劳动积分 -->
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="50px">
      <el-form-item label="学号" prop="studentId">
        <el-input v-model="queryParams.studentId" placeholder="请输入学号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="姓名" prop="studentName">
        <el-input v-model="queryParams.studentName" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="系部" prop="unitName">
        <el-input v-model="queryParams.unitName" placeholder="请输入系部" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="学期" prop="schoolYear">
        <el-input v-model="queryParams.schoolYear" placeholder="请输入学期" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['reportcard:card:add']">劳动教育积分申报</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table border v-loading="loading" :data="labourScoreList">
      <el-table-column label="学期" align="center" prop="schoolYear" />
      <el-table-column label="系部" align="center" prop="unitName" />
      <el-table-column label="学号" align="center" prop="studentId" />
      <el-table-column label="姓名" align="center" prop="studentName" />
      <el-table-column label="班级" align="center" prop="classNo" />
      <el-table-column label="项目类型" align="center" prop="type" />
      <el-table-column label="子项内容" align="center" prop="classNo" />
      <el-table-column label="时长" align="center" prop="classNo" />
      <el-table-column label="等级" align="center" prop="classNo" />
      <el-table-column label="本次获得积分" align="center" prop="classNo" />
      <el-table-column label="劳动教育累计积分" align="center" prop="classNo" />
      <el-table-column label="登记部门" align="center" prop="orgName" />
      <el-table-column label="记录时间" align="center" prop="createTime" />
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
  </div>
</template>

<script>
import { listOrg } from "@/api/organ/classOrgan";

export default {
  name: "labourScore",
  dicts: ['sys_normal_disable', 'orgStatus'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 组织信息表格数据
      labourScoreList: [],
      // 显示搜索条件
      showSearch: true,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      open:false,
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询组织信息列表 */
    getList() {
      this.loading = true;
      listOrg(this.queryParams).then(response => {
        this.labourScoreList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "劳动教育积分申报";
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        userName: null,
        nickName: null,
        college: null,
        schoolYear: null,
      };
      this.resetForm("form");
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
